// 列表区域显示的所有物料
// key 对应的组件映射关系
import { ElButton, ElInput } from 'element-plus';

function createEditorConfig() {
  const componentList = [];
  const componentMap = {};
  return {
    componentList,
    componentMap,
    register: (component) => {
      componentList.push(component);
      componentMap[component.key] = component;
    },
  };
}

export const registerConfig = createEditorConfig();
registerConfig.register({
  key: 'text',
  label: '文本',
  preview: () => '预览文本',
  render: () => '渲染文本',
});

registerConfig.register({
  key: 'button',
  label: ' 按钮',
  preview: () => <ElButton>预览按钮</ElButton>,
  render: () => <ElButton>渲染按钮</ElButton>,
});

registerConfig.register({
  key: 'input',
  label: '输入框',
  preview: () => <ElInput>预览input</ElInput>,
  render: () => <ElInput>渲染input</ElInput>,
});
